<include file="Public:header" />

<script type="text/javascript" charset="utf-8" src="/Public/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/Public/ueditor/ueditor.all.min.js"> </script>


<script type="text/javascript">
	window.UEDITOR_CONFIG.savePath=[ "{$data['site']['info']['url']}"];
    //实例化编辑器
	UE.getEditor('context');
	window.UEDITOR_CONFIG.savePath=[ "huahui/{$data['site']['info']['url']}"];
	UE.getEditor('context2');
</script>

<h1>编辑小站</h1>

<form method="post" id="editFrom">
<table width="100%" border="0">
  <tr>
    <td width="5%">名称</td>
    <td width="95%"><input type="text" name="name" value="{$data['site']['info']['name']}" style="padding:5px; width:200px;" /></td>
  </tr>
  <tr>
    <td>关键词</td>
    <td><input name="keyword" type="text" id="keyword" style="padding:5px; width:200px;" value="{$data['site']['info']['keyword']}" /></td>
  </tr>
  <tr>
    <td valign="top">内容</td>
    <td><textarea name="context" id="context" style="width:90%; height:500px;">{$data['site']['info']['context']}</textarea></td>
  </tr>
  <tr title="不支持任何文本输入,除了图片">
    <td valign="top">相册</td>
    <td><textarea name="photo" id="context2" style="width:90%; height:500px;">{$data['site']['info']['photo']}</textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="button" name="button" id="saveBtn" value="提交" />
      <input name="id" type="hidden" id="id" value="{$data['site']['info']['id']}" /><input name="url" type="hidden" id="url" value="{$data['site']['info']['url']}" /> 
      <a href="/admin.php?m=Admin&c=Index&a=index">返回</a>      </td>
  </tr>
  <tr>
    <td height="176">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>

<script>
$(document).ready(function(){
	var obj = $('#editFrom');
	$('#saveBtn').click(function(){
		var id = obj.find('[name=id]').val();
		var url = '/admin.php?c=Ajax&a=site&do=save&id='+id;
		var data = {'context':obj.find('[name=context]').val(),'photo':obj.find('[name=photo]').val(),'url':obj.find('[name=url]').val(),'name':obj.find('[name=name]').val(),'id':obj.find('[name=id]').val(),'keyword':obj.find('[name=keyword]').val()};
		$.post(url,data,function(rs){
			if(rs.status){
				$.jBox.tip('操作成功','success');
				window.location.href='/admin.php?m=Admin&c=Index&a=index';
			}else{
				$.jBox.tip(rs.info,'error');
			}		
		});
	});
});
</script>
<include file="Public:footer" />
